module game{
    export class HomeView extends BaseEuiView{

        public btn_start:eui.Button;
        public btn_link:eui.Button;
        public btn_rank:eui.Button;
        public btn_share:eui.Button;
        public btn_more:eui.Button;

        public txt_score:eui.Label;
        public constructor($m:BaseController,$parent:eui.Group){
            super($m,$parent);
            this.skinName = "resource/skin/Home.exml";
        }

        /**
         *对面板进行显示初始化，用于子类继承
            *
            */
        public initUI():void{
            super.initUI();

            this.btn_start.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onClickHandler,this);
            this.btn_link.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onClickHandler,this);
            this.btn_rank.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onClickHandler,this);
            this.btn_more.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onClickHandler,this);
            this.btn_share.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onClickHandler,this);

            this.skin.width = egret.MainContext.instance.stage.stageWidth;
            this.skin.height = egret.MainContext.instance.stage.stageHeight;
        }

         
        public open(...param:any[]):void {
            gameData.getWXData();
            this.txt_score.text = gameData.historyScore +"";
        }

        private onClickHandler(e:egret.TouchEvent){
            switch(e.target){
                case this.btn_start:
                    App.ViewManager.close(ViewConst.Home);
                    App.ViewManager.open(ViewConst.Core);
                break;
                case this.btn_link:
                break;
                case this.btn_rank:
                    App.ViewManager.close(ViewConst.Home);
                    App.ViewManager.open(ViewConst.Rank);
                break;
                case this.btn_more:
                break;
                case this.btn_share:
                break;
            }
        }
    }
}